home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / Clueless.swf / scripts / org / flintparticles / actions / Age.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.1 KB  |  51 lines

  1. package org.flintparticles.actions
  2. {
  3.    import org.flintparticles.emitters.Emitter;
  4.    import org.flintparticles.energyEasing.Linear;
  5.    import org.flintparticles.particles.Particle;
  6.    
  7.    public class Age extends Action
  8.    {
  9.        
  10.       
  11.       private var _easing:Function;
  12.       
  13.       public function Age(param1:Function = null)
  14.       {
  15.          super();
  16.          if(param1 == null)
  17.          {
  18.             _easing = Linear.easeNone;
  19.          }
  20.          else
  21.          {
  22.             _easing = param1;
  23.          }
  24.       }
  25.       
  26.       override public function update(param1:Emitter, param2:Particle, param3:Number) : void
  27.       {
  28.          param2.age += param3;
  29.          if(param2.age >= param2.lifetime)
  30.          {
  31.             param2.energy = 0;
  32.             param2.isDead = true;
  33.          }
  34.          else
  35.          {
  36.             param2.energy = _easing(param2.age,param2.lifetime);
  37.          }
  38.       }
  39.       
  40.       public function get easing() : Function
  41.       {
  42.          return _easing;
  43.       }
  44.       
  45.       public function set easing(param1:Function) : void
  46.       {
  47.          _easing = param1;
  48.       }
  49.    }
  50. }
  51.